package com.wfs.suanfa.jvm;


import com.wfs.jvm.ObjectSizeAgent;
import org.openjdk.jol.info.ClassLayout;

/**
 * @author: wfs
 * @Date: 2020/10/19 20:35
 * @Description:
 */
public class MyClassLayout {
    public static void main(String[] args) {
        Object o =new Object();
        o.hashCode();
        System.out.println(ClassLayout.parseInstance(o).toPrintable());
        synchronized (o){
            System.out.println(ClassLayout.parseInstance(o).toPrintable());
        }
        System.out.println(ClassLayout.parseInstance(o).toPrintable());
        int[] arr=new int[2];
        System.out.println(ClassLayout.parseInstance(arr).toPrintable());
        //输出对象的大小
        T t=new T();
        long size = ObjectSizeAgent.siteOf(t);
        System.out.println(size);
        System.out.println(ClassLayout.parseInstance(t).toPrintable());
        System.identityHashCode(t);
        System.out.println(size);;
    }
}

class  T{
    T(){

    }
}
